package com.xc.h05.service.wyl.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xc.h05.entity.Mytest;
import com.xc.h05.mapper.MytestMapper;
import com.xc.h05.service.wyl.MytestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MytestServiceImpl implements MytestService {
    @Autowired
    private MytestMapper mytestMapper;
    @Override
    public int insert(Mytest mytest) {
        return mytestMapper.add(mytest);
    }

    @Override
    public int delete(int id) {
        return mytestMapper.delete(id);
    }

    @Override
    public int deletes(List list) {
        return mytestMapper.deletes(list);
    }

    @Override
    public int update(Mytest mytest) {
        return mytestMapper.update(mytest);
    }


    @Override
    public List<Mytest> findByNicknamePage(Mytest nicename) {
        return mytestMapper.findByNicknamePage(nicename);
    }

    @Override
    public List<Mytest> findByTestId(int testId) {
        return mytestMapper.findByTestId(testId);
    }

    @Override
    public PageInfo<Mytest> findAll(Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Mytest> mytestList = mytestMapper.findAll();
       PageInfo<Mytest> pageInfo = new PageInfo<>(mytestList);
       return pageInfo;

    }
}
